import '../app/mobile/css/mobile.less';
import {
    // 核心
    React, ReactDom, $,
    device, tools,
    App, Icon, Toast,
    Router, Route
} from 'mobile';


// 路由
import Index from '../app/mobile/page/index';


if (window.bootstarp = "ysw.mobile") {
    
    Icon.type = 'ysw';
    
    //语言包
    window.lang = {
        //
        'c.datetime.year': ' 年',
        'c.datetime.month': ' 月',
        //
        'c.datetime.monday': '周一',
        'c.datetime.tuesday': '周二',
        'c.datetime.wednesday': '周三',
        'c.datetime.thursday': '周四',
        'c.datetime.friday': '周五',
        'c.datetime.saturday': '周六',
        'c.datetime.sunday': '周日',
        //
        'c.datetime.january': '一月',
        'c.datetime.february': '二月',
        'c.datetime.march': '三月',
        'c.datetime.april': '四月',
        'c.datetime.may': '五月',
        'c.datetime.june': '六月',
        'c.datetime.july': '七月',
        'c.datetime.august': '八月',
        'c.datetime.september': '九月',
        'c.datetime.october': '十月',
        'c.datetime.november': '十一月',
        'c.datetime.december': '十二月',
    }
    
    App.register('alert', function (msg) {
        window.alert(msg)
    });
    App.register('toast', function (msg) {
        window.toast(msg)
    })
    
    
    window.alert = window.Alert = function (msg) {
        if (window.plus) {
            window.plus.nativeUI.alert(msg, function () {
            }, document.title, "确定");
        } else {
            window.appContext.emit('Alert', msg);
        }
    }
    
    $(function () {
        ReactDom.render((
            <App>
				<Router name="page" transition={['app-page-next', 'app-page-prev']} timeout={500}>
					<Route path="/ysw/mobile/" default={true}>
						<Index/>
					</Route>
				</Router>
            </App>
        ), document.getElementById('react'));
    })
}

